-
Notifications
You must be signed in to change notification settings - Fork 1k
fix(resolver): correctly resolve unnest alias shadowing for BigQuery #6665
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
SQLGlot Integration Test ResultsComparing:
By Dialect
Overallmain: 5697 total, 5429 passed (pass rate: 95.3%), sqlglot version: sqlglot:mlee/qualify-error: 5697 total, 5429 passed (pass rate: 95.3%), sqlglot version: Difference: No change |
georgesittas
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, just a couple of suggestions.
When BigQuery SQL uses an UNNEST expression where the table alias matches a column name in another table, SQLGlot's
qualifyoptimizer step fails due to perceived ambiguous column name.To illustrate, this is valid SQL in BigQuery that fails to qualify:
To fix, resolver is updated as follows:
get_tablewill checkalias.column[0]for the actual alias whenUNNEST_COLUMN_ONLYis true andalias.thisis None_get_unambiguous_columnswill check ambiguous columns against aliases in unnest sources